<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- Begin Header -->
<title>Gitblit</title>
<meta charset="utf-8">
<meta name="ROBOTS" content="INDEX">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
		
<link rel="stylesheet" href="./bootstrap/css/bootstrap.css">
<link rel='shortcut icon' type='image/png' href='./gitblt-favicon.png' />
<link rel="stylesheet" href="./prettify/prettify.css" />
<script src="./prettify/prettify.js"></script>
<script src="./bootstrap/js/jquery.js"></script>
<script src="./bootstrap/js/bootstrap.min.js"></script>
</head>
<body onload='prettyPrint()'>		<!-- Navigation Bar -->
		<div class="navbar navbar-fixed-top">
			<div class="navbar-inner">
				<div class="container">
          			<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            			<span class="icon-bar"></span>
            			<span class="icon-bar"></span>
            			<span class="icon-bar"></span>
          			</a>
          			<a class="brand" href="./"><img src="./gitblt_25_white.png" alt="Gitblit"></img></a>
					<div class="nav-collapse">
						<ul class="nav">
							<li class='dropdown'> <!-- Menu -->
<a class='dropdown-toggle' href='#' data-toggle='dropdown'>about<b class='caret'></b></a>
<ul class='dropdown-menu'>
<li><a href='index.html'>overview</a></li>
<li><a href='features.html'>features</a></li>
</ul></li> <!-- End Menu -->
<li class='dropdown'> <!-- Menu -->
<a class='dropdown-toggle' href='#' data-toggle='dropdown'>documentation<b class='caret'></b></a>
<ul class='dropdown-menu'>
<li class='dropdown-submenu'> <!-- Submenu -->
<a tabindex='-1' href='#'>Gitblit GO</a>
<ul class='dropdown-menu'>
<li><a href='setup_go.html'>setup GO</a></li>
<li><a href='upgrade_go.html'>upgrade GO</a></li>
</ul></li> <!-- End Submenu -->
<li class='divider'></li>
<li class='dropdown-submenu'> <!-- Submenu -->
<a tabindex='-1' href='#'>Gitblit WAR</a>
<ul class='dropdown-menu'>
<li><a href='setup_war.html'>setup WAR</a></li>
<li><a href='upgrade_war.html'>upgrade WAR</a></li>
</ul></li> <!-- End Submenu -->
<li class='divider'></li>
<li class='dropdown-submenu'> <!-- Submenu -->
<a tabindex='-1' href='#'>Server Configuration</a>
<ul class='dropdown-menu'>
<li><a href='administration.html'>administration</a></li>
<li><a href='setup_authentication.html'>authentication</a></li>
<li><a href='setup_hooks.html'>push hooks</a></li>
<li><a href='setup_lucene.html'>lucene indexing</a></li>
<li><a href='setup_proxy.html'>reverse proxies</a></li>
<li><a href='setup_clientmenus.html'>client app menus</a></li>
<li><a href='setup_bugtraq.html'>bugtraq</a></li>
<li><a href='setup_mirrors.html'>mirrors</a></li>
<li><a href='setup_scaling.html'>scaling</a></li>
<li class='divider'></li>
<li><a href='setup_viewer.html'>Gitblit as a viewer</a></li>
</ul></li> <!-- End Submenu -->
<li class='divider'></li>
<li class='dropdown-submenu'> <!-- Submenu -->
<a tabindex='-1' href='#'>Client Usage</a>
<ul class='dropdown-menu'>
<li><a href='setup_transport_http.html'>using HTTP/HTTPS</a></li>
<li><a href='setup_transport_ssh.html'>using SSH</a></li>
<li><a href='eclipse_plugin.html'>using the Eclipse plugin</a></li>
</ul></li> <!-- End Submenu -->
<li class='divider'></li>
<li class='dropdown-submenu'> <!-- Submenu -->
<a tabindex='-1' href='#'>Tickets</a>
<ul class='dropdown-menu'>
<li><a href='tickets_overview.html'>overview</a></li>
<li><a href='tickets_using.html'>using</a></li>
<li><a href='tickets_barnum.html'>barnum</a></li>
<li><a href='tickets_setup.html'>setup</a></li>
<li><a href='tickets_replication.html'>replication & advanced administration</a></li>
</ul></li> <!-- End Submenu -->
<li class='divider'></li>
<li class='dropdown-submenu'> <!-- Submenu -->
<a tabindex='-1' href='#'>Plugins</a>
<ul class='dropdown-menu'>
<li><a href='plugins_overview.html'>overview</a></li>
<li><a href='plugins_extensions.html'>extension points</a></li>
</ul></li> <!-- End Submenu -->
<li class='divider'></li>
<li><a href='federation.html'>federation</a></li>
<li class='divider'></li>
<li><a href='properties.html'>settings</a></li>
<li><a href='faq.html'>faq</a></li>
<li class='divider'></li>
<li><a href='design.html'>design</a></li>
<li><a href='rpc.html'>rpc</a></li>
</ul></li> <!-- End Menu -->
<li class='dropdown'> <!-- Menu -->
<a class='dropdown-toggle' href='#' data-toggle='dropdown'>changelog<b class='caret'></b></a>
<ul class='dropdown-menu'>
<li><a href='releasecurrent.html'>current release</a></li>
<li><a href='releasehistory.html'>older releases</a></li>
</ul></li> <!-- End Menu -->
<li class='dropdown'> <!-- Menu -->
<a class='dropdown-toggle' href='#' data-toggle='dropdown'>links<b class='caret'></b></a>
<ul class='dropdown-menu'>
<li><a href='https://dev.gitblit.com'>dev.gitblit.com (self-hosted)</a></li>
<li class='divider'></li>
<li><a href='http://plugins.gitblit.com'>Plugins Registry</a></li>
<li class='divider'></li>
<li><a href='https://github.com/gitblit/gitblit'>Github</a></li>
<li><a href='https://github.com/gitblit/gitblit'>Issues</a></li>
<li><a href='http://groups.google.com/group/gitblit'>Discussion</a></li>
<li><a href='http://www.ohloh.net/p/gitblit'>Ohloh</a></li>
</ul></li> <!-- End Menu -->

						</ul>
					</div><!--/.nav-collapse -->
				</div>
			</div>
		</div><!-- end Navigation Bar -->
<div class='container'>
<!-- Begin Markdown -->
<h2 class="section" id='H1'><a href="#H1" class="sectionlink"><i class="icon-share-alt"> </i></a>Gitblit GO Installation & Setup</h2>
<ol>
  <li>Download and unzip Gitblit GO <a href="%GCURL%gitblit-1.8.0.zip">1.8.0 (Windows)</a> or <a href="%GCURL%gitblit-1.8.0.tar.gz">1.8.0 (Linux/OSX)</a>.<br/><em>It is best to eliminate spaces in the path name.</em></li>
  <li>The server itself is configured through a simple text file.<br/>Open <code>data/gitblit.properties</code> in your favorite text editor and make sure to review and set:
  <ul>
    <li><em>server.httpPort</em> and <em>server.httpsPort</em></li>
    <li><em>server.storePassword</em> (do not enter <em>#</em> characters)<br/><strong>https</strong> is strongly recommended because passwords are insecurely transmitted form your browser/git client using Basic authentication!</li>
    <li><em>git.packedGitLimit</em> (set larger than the size of your largest repository)</li>
  </ul></li>
  <li>Execute <code>authority.cmd</code> or <code>java -cp gitblit.jar com.gitblit.authority.Launcher --baseFolder data</code> from a command-line<br/><strong>NOTE:</strong> The Authority is a Swing GUI application. Use of this tool is not required as Gitblit GO will startup and create SSL certificates itself, BUT use of this tool allows you to control the identification metadata used in the generated self-signed certificates. Skipping this step will result in certificates with default metadata.
  <ol>
    <li>fill out the fields in the <em>new certificate defaults</em> dialog</li>
    <li>enter the store password used in <em>server.storePassword</em> when prompted. This generates an SSL certificate for <strong>localhost</strong>.</li>
    <li>you may want to generate an SSL certificate for the hostname or ip address hostnames you are serving from<br/><strong>NOTE:</strong> You can only have <strong>one</strong> SSL certificate specified for a port.</li>
    <li>exit the authority app</li>
  </ol></li>
  <li>Execute <code>gitblit.cmd</code> or <code>java -jar gitblit.jar --baseFolder data</code> from a command-line</li>
  <li>Open your browser to <a href="http://localhost:8080">http://localhost:8080</a> or <a href="https://localhost:8443">https://localhost:8443</a> depending on your chosen configuration.</li>
  <li>Enter the default administrator credentials: <strong>admin / admin</strong> and click the <em>Login</em> button<br/><strong>NOTE:</strong> Make sure to change the administrator username and/or password!!</li>
</ol>
<h3 class="section" id='H2'><a href="#H2" class="sectionlink"><i class="icon-share-alt"> </i></a>GO Data Location</h3><p>By default, Gitblit GO stores all data (users, settings, repositories, etc) in the <code>data</code> subfolder of your GO installation. You may specify an external location for your data on the command-line by setting the <em>--baseFolder</em> argument. If you relocate the data folder then you must supply the <em>--baseFolder</em> argument to both GO and the Certificate Authority.</p><p>If you are deploying Gitblit to a *nix platform, you might consider moving the data folder out of the GO installation folder and then creating a symlink named "data" that points to your moved folder.</p>
<h4 class="section" id='H3'><a href="#H3" class="sectionlink"><i class="icon-share-alt"> </i></a>Specifying baseFolder via GITBLIT_HOME</h4><p>You can specify <code>GITBLIT_HOME</code> either as an environment variable or as a <code>-DGITBLIT_HOME</code> JVM system property.</p>
<h3 class="section" id='H4'><a href="#H4" class="sectionlink"><i class="icon-share-alt"> </i></a>Including Other Properties</h3><p>SINCE 1.7.0</p><p>Gitblit supports loading it's settings from multiple properties files. You can achieve this using the <code>include=filename</code> key. This setting supports loading multiple files using a <em>comma</em> as the delimiter. They are processed in the order defined and they may be nested (i.e. your included properties may include properties, etc, etc).</p>
<h3 class="section" id='H5'><a href="#H5" class="sectionlink"><i class="icon-share-alt"> </i></a>Creating your own Self-Signed SSL Certificate</h3><p>Gitblit GO (and Gitblit Certificate Authority) automatically generates a Certificate Authority (CA) certificate and an ssl certificate signed by this CA certificate that is bound to <em>localhost</em>.</p><p>Remote Eclipse/EGit/JGit clients (&lt; 3.0) will fail to communicate using this certificate because JGit always verifies the hostname of the certificate, regardless of the <em>http.sslVerify=false</em> client-side setting.</p><p>The EGit failure message is something like:</p>
<pre><code>Cannot get remote repository refs.
Reason: https:/myserver.com/git/myrepo.git: cannot open git-upload-pack
</code></pre><p>If you want to serve your repositories to another machine over https then you will want to generate a new certificate for the hostname or ip address you are serving from.</p><p><strong>NOTE:</strong> The Gitblit Authority is a GUI tool and will require X11 forwarding on headless UNIX boxes.</p>
<ol>
  <li><code>authority.cmd</code> or <code>java -jar authority.jar --baseFolder data</code></li>
  <li>Click the <em>new ssl certificate</em> button (red rosette in the toolbar in upper left of window)</li>
  <li>Enter the hostname or ip address</li>
  <li>Make sure the checkbox <em>serve https with this certificate</em> is checked</li>
  <li>In the keystore password prompt, enter the <em>server.storePassword</em> password</li>
</ol><p>If you decide to change the value of <em>server.storePassword</em> (recommended) <u>after</u> you have already started Gitblit or Gitblit Certificate Authority, then you will have to delete the following files and then restart the Gitblit Certificate Authority app:</p>
<ol>
  <li>data/serverKeyStore.jks</li>
  <li>data/serverTrustStore.jks</li>
  <li>data/certs/caKeyStore.jks</li>
  <li>data/certs/ca.crt</li>
  <li>data/certs/caRevocationList.crl (optional)</li>
</ol>
<h3 class="section" id='H6'><a href="#H6" class="sectionlink"><i class="icon-share-alt"> </i></a>Client SSL Certificates</h3><p>SINCE 1.2.0</p><p>Gitblit supports X509 certificate authentication. This authentication method relies on your servlet container to validate/verify/trust your client certificate and can be used by your browser and your git client.</p><p>All X509 certificates have a <em>distinguished name (DN)</em> which is a signature of several fields like:</p>
<pre><code>C=US,O=Gitblit,OU=Gitblit,CN=james
</code></pre><p>Gitblit must be able to map the DN of the certificate to an <em>existing</em> account username. The default mapping is to extract the <em>common name (CN)</em> value from the DN and use that as the account name. If the CN is a valid account, then the user is authenticated. The servlet container which runs Gitblit validates, verifies, and trusts the certificate passed to Gitblit. If you need to specify an alternative DN mapping you may do so with the <em>git.certificateUsernameOIDs</em> setting, but this mapping must be matched to the user account name.</p><p>How do you make your servlet container trust a client certificate?</p><p>In the WAR variant, you will have to manually setup your servlet container to:</p>
<ol>
  <li>want/need client certificates</li>
  <li>trust a CA certificate used to sign your client certificates</li>
  <li>generate client certificates signed by your CA certificate</li>
</ol><p>Alternatively, Gitblit GO is designed to facilitate use of client certificate authentication. Gitblit GO ships with a tool that simplifies creation and management of client certificates, Gitblit Certificate Authority.</p>
<h4 class="section" id='H7'><a href="#H7" class="sectionlink"><i class="icon-share-alt"> </i></a>Creating SSL Certificates with Gitblit Certificate Authority</h4><p>When you generate a new client certificate, a zip file bundle is created which includes a P12 keystore for browsers and a PEM keystore for Git. Both of these are password-protected. Additionally, a personalized README file is generated with setup instructions for popular browsers and Git. The README is generated from <code>data\certs\instructions.tmpl</code> and can be modified to suit your needs.</p>
<ol>
  <li><code>authority.cmd</code> or <code>java -jar authority.jar --baseFolder data</code></li>
  <li>Select the user for which to generate the certificate</li>
  <li>Click the <em>new certificate</em> button and enter the expiration date of the certificate. You must also enter a password for the generated keystore. This password is <em>not</em> the same as the user's login password. This password is used to protect the privatekey and public certificate you will generate for the selected user. You must also enter a password hint for the user.</li>
  <li>If your mail server settings are properly configured you will have a <em>send email</em> checkbox which you can use to immediately send the generated certificate bundle to the user.</li>
</ol>
<h4 class="section" id='H8'><a href="#H8" class="sectionlink"><i class="icon-share-alt"> </i></a>Certificate Inspection and Advanced Troubleshooting</h4><p>X509 certificates can be confusing and tricky even with the simplified Gitblit Certificate Authority tool. If you find you need more tooling to understand your keystores, certificates, and certificate revocation lists (CRLs), I highly recommend <a href="http://portecle.sourceforge.net">Portecle</a> which can be conveniently launched as a <a href="http://portecle.sourceforge.net/webstart/portecle.jnlp">Java Web Start app</a>.</p>
<h3 class="section" id='H9'><a href="#H9" class="sectionlink"><i class="icon-share-alt"> </i></a>Running as a Windows Service</h3><p>Gitblit uses <a href="http://commons.apache.org/daemon">Apache Commons Daemon</a> to install and configure its Windows service.</p>
<ol>
  <li><strong>Review the contents</strong> of the <code>installService.cmd</code> where you may have to change the <u>default keystore password</u>.</li>
  <li>Set the <em>ARCH</em> value as appropriate for your installed Java Virtual Machine.</li>
  <li>Add any necessary <em>--StartParams</em> as enumerated below in <strong>Command-Line Parameters</strong>.</li>
  <li>Execute the script.</li>
</ol><p>After service installation you can use the <code>gitblitw.exe</code> utility to control and modify the runtime settings of the service.<br/>Additional service definition options and runtime capabilities of <code>gitblitw.exe</code> (prunmgr.exe) are documented <a href="http://commons.apache.org/daemon/procrun.html">here</a>.</p><p><strong>NOTE:</strong><br/>If you change the name of the service from <em>gitblit</em> you must also change the name of <code>gitblitw.exe</code> to match the new service name otherwise the connection between the service and the utility is lost, at least to double-click execution. </p>
<h4 class="section" id='H10'><a href="#H10" class="sectionlink"><i class="icon-share-alt"> </i></a>VM Considerations</h4><p>By default, the service installation script configures your Windows service to use your default JVM. This setup usually defaults to a client VM.<br/>If you have installed a JDK, you might consider using the <code>gitblitw.exe</code> utility to manually specify the <em>server</em> VM.</p>
<ol>
  <li>Execute <code>gitblitw.exe</code></li>
  <li>On the <em>Java</em> tab uncheck <em>Use default</em>.</li>
  <li>Manually navigate your filesystem and specify the server VM with the <code>...</code> button<br/><pre>Java Virtual Machine:<br/>C:\Program Files\Java\jre6\bin\server\jvm.dll</pre></li>
</ol>
<h4 class="section" id='H11'><a href="#H11" class="sectionlink"><i class="icon-share-alt"> </i></a>Command-Line Parameters</h4><p>Command-Line parameters override the values in <code>gitblit.properties</code> at runtime.</p>
<pre><code>--baseFolder           The default base folder for all relative file reference settings
--repositoriesFolder   Git Repositories Folder
--userService          Authentication and Authorization Service (filename or fully qualified classname)
--httpPort             HTTP port for to serve. (port &lt;= 0 will disable this connector)
--httpsPort            HTTPS port to serve.  (port &lt;= 0 will disable this connector)
--sshPort              SSH Daemon port to serve.  (port &lt;= 0 will disable this daemon)
--gitPort              Git Daemon port to serve.  (port &lt;= 0 will disable this daemon)
--alias                Alias in keystore of SSL cert to use for https serving
--storePassword        Password for SSL (https) keystore.
--shutdownPort         Port for Shutdown Monitor to listen on. (port &lt;= 0 will disable this monitor)
--dailyLogFile         Redirect logging to a rolling, daily log file instead of stdout
--tempFolder           Folder for server to extract built-in webapp
</code></pre><p><strong>Example</strong></p>
<pre><code>java -jar gitblit.jar --userService c:/myrealm.config --storePassword something --baseFolder c:/data
</code></pre>
<h4 class="section" id='H12'><a href="#H12" class="sectionlink"><i class="icon-share-alt"> </i></a>Overriding Gitblit GO's Log4j Configuration</h4><p>You can override Gitblit GO's default Log4j configuration with a command-line parameter to the JVM.</p>
<pre><code>java -Dlog4j.configuration=file:///home/james/log4j.properties -jar gitblit.jar &lt;optional_gitblit_args&gt;
</code></pre><p>You can not use override the default log4j configuration <em>AND</em> specify the <code>--dailyLogFile</code> parameter. For reference, here is <a href="https://github.com/gitblit/gitblit/blob/master/src/log4j.properties">Gitblit's default Log4j configuration</a>. It includes some file appenders that are disabled by default. 
<!-- End Markdown -->
<div ><ul class="pager"> <li class="next"><a href="upgrade_go.html">upgrade GO &rarr;</a></li></ul></div><footer class="footer"><p class="pull-right">generated 2016-06-22</p>
<p>The content of this page is licensed under the <a href="http://creativecommons.org/licenses/by/3.0">Creative Commons Attribution 3.0 License</a>.</p>
</footer>
</div>
</body>
</html>